package com.yaowk.authc.model;

import com.yaowk.authc.model.base.BasePermission;

import java.util.List;

/**
 * 权限
 * Created by yaowenkai on 2017/3/31.
 */
public class Permission extends BasePermission<Permission> {
    public static Permission dao = new Permission();

    /**
     * 通过角色id查询权限
     *
     * @param roleId
     * @return
     */
    public List<Permission> findListByRoleId(Integer roleId) {
        return find(getSql("permission.selectByRoleId"), roleId);
    }

    /**
     * 通过用户id查询权限
     *
     * @param userId
     * @return
     */
    public List<Permission> findListByUserId(Integer userId) {
        return find(getSql("permission.selectByUserId"), userId);
    }

    /**
     * 通过平台id查询权限
     *
     * @param platformId
     * @return
     */
    public List<Permission> findByPlatformId(Integer platformId) {
        return find(getSql("permission.selectByPlatformId"), platformId);
    }

    public List<Permission> findAll() {
        return find(getSql("permission.selectAll"));
    }
}
